package bdd.standalone.bean;

import java.util.Date;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Bean DatabasePlaning
 * @author Guillaume Pocas & Jean-Fraçois Augé
 */
@Entity
@Table(name = "db_planning")
public class DatabasePlanning {

	@Id
	@GeneratedValue
	@Column(name = "dbplan_id")
	private int dbplan_id;
	
	@ManyToOne
    @JoinColumn(name = "globserv_id")
	private GlobalServer globalServer;
	
	@Column(name = "dbplan_dbpath", nullable = false)
	private String dbplan_dbpath;
	
	@Column(name = "dbplan_timeBegin", nullable = false)
	private Date dbplan_timeBegin;
	
	@Column(name = "dbplan_timeEnd", nullable = false)
	private Date dbplan_timeEnd;
	
	@Column(name = "dbplan_dayBegin", nullable = false)
	private Date dbplan_dayBegin;
	
	@Column(name = "dbplan_dayEnd", nullable = false)
	private Date dbplan_dayEnd;
	
	@OneToMany(mappedBy="databasePlanning")
    private Set<Planning> plannings;
	
	/**
	 * Constructeur vide.
	 */
	public DatabasePlanning(){ }
	
	/**
	 * Créer un nouveau DatabasePlanning.
	 * @param path
	 * @param timeBegin
	 * @param timeEnd
	 * @param dayBegin
	 * @param dayEnd
	 */
	public DatabasePlanning(String path, Date timeBegin, Date timeEnd, Date dayBegin, Date dayEnd){
		this.dbplan_dbpath = path;
		this.dbplan_timeBegin = timeBegin;
		this.dbplan_timeEnd = timeEnd;
		this.dbplan_dayBegin = dayBegin;
		this.dbplan_dayEnd = dayEnd;
	}

	public int getDbplan_id() { return dbplan_id;	}
	public void setDbplan_id(int dbplan_id) { this.dbplan_id = dbplan_id;	}

	public GlobalServer getGlobalServer() { return globalServer;	}
	public void setGlobalServer(GlobalServer globalServer) { this.globalServer = globalServer;	}

	public String getDbplan_dbpath() { return dbplan_dbpath;	}
	public void setDbplan_dbpath(String dbplan_dbpath) { this.dbplan_dbpath = dbplan_dbpath;	}

	public Date getDbplan_timeBegin() { return dbplan_timeBegin;	}
	public void setDbplan_timeBegin(Date dbplan_timeBegin) { this.dbplan_timeBegin = dbplan_timeBegin;	}

	public Date getDbplan_timeEnd() { return dbplan_timeEnd;	}
	public void setDbplan_timeEnd(Date dbplan_timeEnd) { this.dbplan_timeEnd = dbplan_timeEnd;	}

	public Date getDbplan_dayBegin() { return dbplan_dayBegin;	}
	public void setDbplan_dayBegin(Date dbplan_dayBegin) { this.dbplan_dayBegin = dbplan_dayBegin;	}

	public Date getDbplan_dayEnd() { return dbplan_dayEnd;	}
	public void setDbplan_dayEnd(Date dbplan_dayEnd) { this.dbplan_dayEnd = dbplan_dayEnd;	}

	public Set<Planning> getPlannings() { return plannings;	}
	public void setPlannings(Set<Planning> plannings) { this.plannings = plannings;	}
	
}
